package cn.iocoder.yudao.module.member.dal.mysql.studentCurriculumVitae;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.student.vo.StudentFileVO;
import cn.iocoder.yudao.module.member.controller.admin.studentCurriculumVitae.vo.StudentCurriculumVitaeExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.studentCurriculumVitae.vo.StudentCurriculumVitaePageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.studentCurriculumVitae.StudentCurriculumVitaeDO;
import cn.iocoder.yudao.module.member.dal.dataobject.studentCurriculumVitae.StudentFileDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 用户简历 Mapper
 *
 * @author 周枫皓
 */
@Mapper
public interface StudentCurriculumVitaeMapper extends BaseMapperX<StudentCurriculumVitaeDO> {

    default PageResult<StudentCurriculumVitaeDO> selectPage(StudentCurriculumVitaePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StudentCurriculumVitaeDO>()
                .likeIfPresent(StudentCurriculumVitaeDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(StudentCurriculumVitaeDO::getSex, reqVO.getSex())
                .eqIfPresent(StudentCurriculumVitaeDO::getLiveCity, reqVO.getLiveCity())
                .likeIfPresent(StudentCurriculumVitaeDO::getCourses, reqVO.getCourses())
                .likeIfPresent(StudentCurriculumVitaeDO::getLanguageAbility, reqVO.getLanguageAbility())
                .likeIfPresent(StudentCurriculumVitaeDO::getSpecialtyAbility, reqVO.getSpecialtyAbility())
//                .likeIfPresent(StudentCurriculumVitaeDO::getEducationalExperience, reqVO.getEducationalExperience())
                .eqIfPresent(StudentCurriculumVitaeDO::getPhoneNumber, reqVO.getPhoneNumber())
                .eqIfPresent(StudentCurriculumVitaeDO::getEmail, reqVO.getEmail())
                .eqIfPresent(StudentCurriculumVitaeDO::getSpecialty, reqVO.getSpecialty())
                .eqIfPresent(StudentCurriculumVitaeDO::getEducation, reqVO.getEducation())
                .eqIfPresent(StudentCurriculumVitaeDO::getDiploma, reqVO.getDiploma())
                .betweenIfPresent(StudentCurriculumVitaeDO::getBirthday,reqVO.getStartDate(),reqVO.getEndDate())
                .orderByDesc(StudentCurriculumVitaeDO::getId));
    }
    List<StudentCurriculumVitaeDO> selectPage1(@Param("request")StudentCurriculumVitaePageReqVO reqVO);

    Integer count1(@Param("request")StudentCurriculumVitaePageReqVO reqVO);

    default List<StudentCurriculumVitaeDO> selectList(StudentCurriculumVitaeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StudentCurriculumVitaeDO>()
                .likeIfPresent(StudentCurriculumVitaeDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(StudentCurriculumVitaeDO::getPhoneNumber, reqVO.getPhoneNumber())
                .eqIfPresent(StudentCurriculumVitaeDO::getStudentId, reqVO.getStudentId())
                .eqIfPresent(StudentCurriculumVitaeDO::getEmail, reqVO.getEmail())
                .eqIfPresent(StudentCurriculumVitaeDO::getSpecialty, reqVO.getSpecialty())
                .eqIfPresent(StudentCurriculumVitaeDO::getEducation, reqVO.getEducation())
                .eqIfPresent(StudentCurriculumVitaeDO::getDiploma, reqVO.getDiploma())
                .orderByDesc(StudentCurriculumVitaeDO::getId));
    }

    void saveStudentFile(@Param("request") StudentFileDO request);

    List<StudentFileVO> getStudentFileList(IPage page, @Param("params") Map<String, Object> params);

}
